package Json;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

/**
 * Created by wangyg 
 * on 2017/7/7 8:45
 */
public class JsonTest {

	public static void main(String[] args) {
		String str=new String("{\n"
				+ "    \"name\": {\n"
				+ "        \"xiaoming\": {\n"
				+ "            \"age\": 17,\n"
				+ "            \"sex\": \"female\"\n"
				+ "        }\n"
				+ "    }\n"
				+ "}");
		JSONObject obj=JSONObject.fromObject(str);

		JSONArray array=new JSONArray();
		array.add(obj);
		System.out.println(array);
		JSONObject jsonObject = array.getJSONObject(0);
		jsonObject.put("123","456");
		System.out.println(array);
	}
}
